var coumt = 8 //每页的个数 
var datas = null
var xiaobiao = 0

function addspicture(e) {
    //确定分页
    var pagesize = Math.ceil(datas.length / coumt)
    var htmls = ""
        // console.log("e")
    console.log(pagesize)
    for (var i = e * coumt; i < coumt * (e + 1); i++) {
        // console.log(pagesize)
        // console.log(i)
        if (datas[i]) {
            htmls += `<li style="border:1px solid black;padding: 0px;width: 220px;height: 250px;margin: 10px 5px"><a href="yanglao/lianjie.html"
                                    style="border: 1px soild #ccc;">
                                    <img src="${datas[i].img}"
                                        alt="中国人民解放军总医院" id="one_picture">
                                </a>
                                <h3 class="title">
                                    <img src="${datas[i].logo}" alt="VIP"
                                        title="VIP:${datas[i].grade}级">
                                    <br />
                                    <a href="yanglao/lianjie.html" style="font-size: 2xp;" id="fonttitle ">${datas[i].name}</a>
                                </h3>
                                <div class="bt1">
                                    <input type="button" value="详情" style="margin-right: 20px;" onclick="jiefang()">
                                    <input type="button" value="预约">
                                </div>
                            </li>`
        }
        document.getElementById("one").innerHTML = htmls
    }
}
//少页
function addphone(start, last) {

    var htmls = ""
    for (var i = start; i < last; i++) {
        // console.log(pagesize)
        // console.log(i)
        if (datas[i]) {
            htmls += `<li style="border:1px solid black;padding: 0px;width: 220px;height: 250px;margin: 10px 5px"><a href="jiefangjun.html"
                                    style="border: 1px soild #ccc;">
                                    <img src="${datas[i].img}"
                                        alt="中国人民解放军总医院" id="one_picture">
                                </a>
                                <h3 class="title">
                                    <img src="${datas[i].logo}" alt="VIP"
                                        title="VIP:${datas[i].grade}级">
                                    <br />
                                    <a href="jiefangjun.html" style="font-size: 2xp;" id="fonttitle ">${datas[i].name}</a>
                                </h3>
                                <div class="bt1">
                                    <input type="button" value="详情" style="margin-right: 20px;" onclick="jiefang()">
                                    <input type="button" value="预约">
                                </div>
                            </li>`
        }
        document.getElementById("one").innerHTML = htmls
        if (xiaobiao == 0) {
            document.getElementById("botoomdiv").remove()
            document.getElementById("picturediv").style.height = "310px"
            xiaobiao++
        }
    }
}
$(function() {
    // var count = $("a")
    // for (var i = 0; i < count.length; i++) {
    //     count[i].mousemove.css("color", "red")
    // }
    $.getJSON("../json/yanglaozhongxin.json", function(e) {
        datas = e
        console.log(e)
            // addpicture()
        addspicture(0)
            // ma  
    })
})

function jiefang() {
    window.location.href = "../yanglao/yanglao/lianjie.html"
}

function a() {
    addphone(1, 3)
}

function ne() {
    window.location.href = "yanglaomain.html"
}

function b() {
    addphone(3, 4)
}

function c() {
    addphone(4, 6)
}

function e() {
    addphone(6, 7)
}

function f() {
    addphone(7, 8)
}

function g() {
    addphone(8, 9)
}

function h() {
    addphone(4, 7)
}

function i() {
    addphone(9, 11)
}

function j() {
    addphone(11, 12)
}

function k() {
    addphone(12, 15)
}

function l() {
    addphone(15, 18)
}

function m() {
    addphone(18, 20)
}

function n() {
    addphone(20, 22)
}

function o() {
    addphone(22, 26)
}

$(document).ready(function() {



    $("#menu2 li a").wrapInner('<span class="out"></span>');



    $("#menu2 li a").each(function() {

        $('<span class="over">' + $(this).text() + '</span>').appendTo(this);

    });



    $("#menu2 li a").hover(function() {

        $(".out", this).stop().animate({ 'top': '48px' }, 300); // move down - hide

        $(".over", this).stop().animate({ 'top': '0px' }, 300); // move down - show



    }, function() {

        $(".out", this).stop().animate({ 'top': '0px' }, 300); // move up - show

        $(".over", this).stop().animate({ 'top': '-48px' }, 300); // move up - hide

    });



});